package com.jinyu.jyly.adapter;

import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.makeramen.roundedimageview.RoundedImageView;
import com.jinyu.jyly.R;
import com.jinyu.jyly.bean.MallListInfo;

import java.util.List;


/**
 *
 */
public class MallTabAdapter extends BaseQuickAdapter<MallListInfo, BaseViewHolder> {

    public MallTabAdapter(List<MallListInfo> data, int layoutResIds) {
        super(layoutResIds, data);
    }


    @Override
    protected void convert(final BaseViewHolder helper, final MallListInfo item) {
        helper.setText(R.id.tv_title,item.getName());
        helper.setText(R.id.tv_price,"￥"+item.getPrice()+"");

        RequestOptions options = new RequestOptions();
        options.error(R.mipmap.space_list);
        Glide.with(mContext).load(item.getThumb())
                .apply(options)
                .into((RoundedImageView) helper.getView(R.id.iv_icon));
        ImageView iv_already_img = helper.getView(R.id.iv_already_img);
        int enable = item.getEnable();
        //0是没有，1是有
        if(0 == enable){
            //没有被拍卖过
            iv_already_img.setVisibility(View.GONE);
        }else if(1 == enable){
            iv_already_img.setVisibility(View.VISIBLE);
        }else{
            iv_already_img.setVisibility(View.GONE);
        }

    }


}


